﻿@namespace BootstrapBlazor.Components
@inherits ComponentBase
@typeparam BusinessInterface where BusinessInterface : class, IGetRenderAllFilterCondition
@inject IStrongTypeInvokeFactory StrongTypeInvokeFactory

<SearchPanel GetRenderCondition="@(GetRenderCondition??ToolServerInterface.GetConditionFunction<BusinessInterface>(StrongTypeInvokeFactory))"
             SearchViewerState="SearchViewerState" Submit="Submit"
             ElementNumber=ElementNumber OnClear=OnClear!>
    <RenderComponent>
        @if (RenderComponent is null)
        {
            <div class="commonContainers">
                <div class="perfectContainer">
                    @context.RenderConditionAll
                </div>
                @context.RenderSubmit
            </div>
        }
        else
        {
            @RenderComponent(context)
        }
    </RenderComponent>
    <RenderProperty>
        @if (RenderProperty is null)
        {
            <BootstrapSearchPanelProperty RenderPropertyInfo="context" />
        }
        else
        {
            @RenderProperty(context)
        }
    </RenderProperty>
    <RenderSubmit>
        @if (RenderSubmit is null)
        {
            <div class="compactCentered">
                <Button Text="执行搜索" OnClick="@context.Submit" />
                <Button Text="清除搜索" OnClick="@context.Clear" />
                <Button Text="回到顶部" OnClick="@context.GoToTop" />
            </div>
        }
        else
        {
            @RenderSubmit(context)
        }
    </RenderSubmit>
</SearchPanel>